﻿using XmlStudio.Utilities;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace XmlStudio.Tests {


    /// <summary>
    ///This is a test class for XmlCheckerTest and is intended
    ///to contain all XmlCheckerTest Unit Tests
    ///</summary>
    [TestClass()]
    public class XmlCheckerTest {
        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext {
            get {
                return testContextInstance;
            }
            set {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for CheckAttributeName
        ///</summary>
        [TestMethod()]
        public void CheckAttributeNameNegativeTest() {
            var attributeName = "@$#%Rsfdklsf";
            var error = XmlChecker.CheckAttributeName(attributeName);
            Assert.IsTrue(!string.IsNullOrEmpty(error));
        }

        /// <summary>
        ///A test for CheckAttributeName
        ///</summary>
        [TestMethod()]
        public void CheckAttributeNamePositiveTest() {
            var attributeName = "attribute";
            var error = XmlChecker.CheckAttributeName(attributeName);
            Assert.IsTrue(string.IsNullOrEmpty(error));
        }

        /// <summary>
        ///A test for CheckAttributeValue
        ///</summary>
        [TestMethod()]
        public void CheckAttributeValueTest() {
            var attributeValue = "&%@$#%R$sdf";
            var error = XmlChecker.CheckAttributeValue(attributeValue);
            Assert.IsTrue(string.IsNullOrEmpty(error));
        }

        /// <summary>
        ///A test for CheckElementName
        ///</summary>
        [TestMethod()]
        public void CheckElementNameNegativeTest() {
            var elementName = "#$#54etf_'";
            var error = XmlChecker.CheckElementName(elementName);
            Assert.IsTrue(!string.IsNullOrEmpty(error));
        }

        /// <summary>
        ///A test for CheckElementName
        ///</summary>
        [TestMethod()]
        public void CheckElementNamePositiveTest() {
            var elementName = "element";
            var error = XmlChecker.CheckElementName(elementName);
            Assert.IsTrue(string.IsNullOrEmpty(error));
        }

        /// <summary>
        ///A test for CheckElementNamespaceUri
        ///</summary>
        [TestMethod()]
        public void CheckElementNamespaceUriNegativeTest() {
            var namespaceUri = "<>@$#$%T$";
            var error = XmlChecker.CheckElementNamespaceUri(namespaceUri);
            Assert.IsTrue(string.IsNullOrEmpty(error));
        }

        /// <summary>
        ///A test for CheckElementPrefix
        ///</summary>
        [TestMethod()]
        public void CheckElementPrefixNegativeTest() {
            string prefix = "@$#r$SDFDS";
            var error = XmlChecker.CheckElementPrefix(prefix);
            Assert.IsTrue(!string.IsNullOrEmpty(error));
        }

        /// <summary>
        ///A test for CheckElementPrefix
        ///</summary>
        [TestMethod()]
        public void CheckElementPrefixPositiveTest() {
            string prefix = "a";
            var error = XmlChecker.CheckElementPrefix(prefix);
            Assert.IsTrue(string.IsNullOrEmpty(error));
        }
    }
}
